﻿$(function() {
	$('#backurl').attr("href", "onlinerepair/_getMyOnlineRepairList?nowpage=1&pagesize=8");
	$('.pb100').attr("style", "margin-left: 4% !important; padding-left: 4% !important margin-right: 4% !important; padding-right: 4% !important;");
	$("button").attr("id", "submit");
	$(document).on('click', '#submit', function() {
		var b = {};
		b["repair_title"] = $('#repair_title').val();
		b["repair_text"] = $('#repair_text').val();
		b["repair_address"] = $('#repair_address').val();
		b["repair_contact"] = $('#repair_contact').val();
		if (b != null) {
			for (var c in b) {
				var d = "#" + c;
				if ($(d).val().length == 0) {
					$(d).attr("placeholder", "该内容是必须填写的！");
					return
				}
			}
		} else if (b == null) {
			alert("错误！");
			return
		}
		$.ajax({
			url: '/MV/onlinerepair/_addMyOnlineRepairInfo',
			type: 'POST',
			dataType: 'json',
			data: b,
			success: function(a) {
				alert("提交成功！");
				window.location.href = encodeURI("onlinerepair/_getMyOnlineRepairList?nowpage=1&pagesize=8");
			},
			error: function(a) {
				alert("错误！");
			}
		});
	});
});